package com.srd.phone.bean;


import com.srd.phone.utils.CommonUtils;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

public class TenderLoan {


    public int id;  // 标ID
    public String nm;  // 标名
    public double moneys;  // 金额
    public String ctime;  // 时间

    public static List<TenderLoan> parseData(String json){
        List<TenderLoan> list = new ArrayList<TenderLoan>();
        try {
            JSONArray jsonArray = new JSONArray(json);
            for (int i = 0; i < jsonArray.length(); i++) {
                TenderLoan item = new TenderLoan();
                JSONObject jsonObject = jsonArray.getJSONObject(i);
                item.id = jsonObject.optInt("id");
                item.nm = jsonObject.optString("nm");
                item.moneys = jsonObject.optDouble("moneys",0);
                item.ctime = CommonUtils.formatDataStr(jsonObject.optString("ctime"));
                list.add(item);
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return list;
    }
}
